package tests;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class TestAddAtEnd
{
    public static void main(String[] args)
    {
	ArrayList arrayList = new ArrayList();
	LinkedList linkedList = new LinkedList();

	long time = TestAddAtEnd.AddAtEnd(arrayList);
	System.out.println("ArrayList: " + time + "ms");

	time = TestAddAtEnd.AddAtEnd(linkedList);
	System.out.println("LinkedList: " + time + "ms");
    }

    private static long AddAtEnd(List list)
    {
	long begin = System.currentTimeMillis();
	int size = 100000;

	for (int i = 0; i < size; i++)
	{
	    list.add(i);
	}

	long end = System.currentTimeMillis();

	return end - begin;
    }
}
